<template>
  <div>
    <div id="con" style="width:500px;height:400px;"></div>
  </div>
</template>
<script>
export default {
  props: ['piedata'],
  created () {
    this.$nextTick(() => {
      this.makePie()
    })
  },
  watch: {
    piedata () {
      this.makePie()
    }
  },
  mounted () {},
  methods: {
    makePie () {
      var myCharts = this.$echarts.init(document.getElementById('con'))
      var option = {
        title: {
          text: '系统人员统计',
          subtext: '每日5点更新',
          left: 'center'
        },
        tooltip: {
          trigger: 'item'
        },
        legend: {
          orient: 'vertical',
          left: 'left'
        },
        series: [
          {
            name: 'Access From',
            type: 'pie',
            radius: '50%',
            data: this.piedata,
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      }

      myCharts.setOption(option)
    }
  }
}
</script>
<style lang="less"></style>
